﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

class QWebSocket;
class QWebSocketServer;

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void On_Open_Socket_Server_clicked();
    void On_Open_Socket_Client_clicked();
    void On_Server_send_clicked();
    void On_Client_send_clicked();

    void OnNewConnection();                                 //server端连接到新socket
    void Receive_Client_Message(const QString &message);    //server端接收到client端消息
    void Receive_Server_Message(const QString &message);    //client端接收到server端消息


private:
    Ui::MainWindow *ui;

    QWebSocket          *myClient;
    QWebSocketServer    *myServer;
    QList<QWebSocket*>  myClientList;

};
#endif // MAINWINDOW_H
